package com.bianguo.android.iocdemo.view.widget.state;

import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.view.animation.LinearInterpolator;

public class ExpandState extends SplashState {

    public ExpandState(float mCircleR, float mDistance) {
        ValueAnimator animator = ValueAnimator.ofFloat(mCircleR, mDistance);
        animator.setDuration(600);
        animator.setInterpolator(new LinearInterpolator());
        animator.addUpdateListener(valueAnimator -> {
            if (stateListener != null) {
                stateListener.updateCurrentHoleRadius((float) valueAnimator.getAnimatedValue());
            }
        });
        animator.start();
    }

    @Override
    public void drawState(Canvas canvas) {
        if (stateListener != null) {
            stateListener.onDrawState(this, canvas);
        }
    }
}
